// pages/auth/index.js

import {
    request
} from "../../request/index.js";
import {
    getSetting,
    chooseAddress,
    openSetting,
    showModal,
    login,
    showToast
} from "../../utils/asyncWx.js"
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },
    async handleGetUserInfo(e) {
        const {
            encryptedData,
            rawData,
            iv,
            signature
        } = e.detail;
        const {
            code
        } = await login();
        const lgoinParams = {
            encryptedData,
            rawData,
            iv,
            signature,
            code
        }
        console.log(lgoinParams);
        const res = await request({
            url: "https://api-hmugo-web.itheima.net/api/public/v1/users/wxlogin",
            data: lgoinParams,
            method: "post"
        });
        console.log(res);
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    }
})